﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class ybqy_print_fengmian : System.Web.UI.Page
{
    Datacon dataconn = new Datacon();
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection cn = dataconn.getcon();
        cn.Open();
        SqlDataReader dr;
        string sql = "select * from danwei where id=" + Session["danweiid"];
        SqlCommand myCommand = new SqlCommand(sql, cn);
        SqlDataReader reader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
        if (reader.Read())
        {
            Label1.Text = reader["danweimingchen"].ToString();
        }
        //cn.Open();
        //GridView1.EditIndex = -1;
        sql = "update danwei set dayingshijian=getdate() where id=" + Session["danweiid"];
         myCommand.CommandText = sql;
         reader.Close();
         cn.Open();
        dr = myCommand.ExecuteReader();
        //GridView1.EditIndex = -1;
        cn.Close();
        dataconn.bind(GridView1, "SELECT Student.ID, Student.Name, Student.kaoshenghao,Student.peixunpici,danwei.danweimingchen,  bumeng.bumenmingcheng FROM Student,danwei,bumeng where danwei.id = Student.danweiid and bumeng.id = Student.bumenid and Student.danweiid=" + Session["danweiid"]);

    }
}